<?php


namespace Tbf\Bundle\TestBundle\TestSuite;


class Assert extends \PHPUnit_Framework_Assert{
    /**
     * 确认相等
     * 1.如果$expect和$input都是某种数值(is_numeric),则用==比较相等
     * 2.如果$expect和$input都是数组,则用PHPUnit_Framework_TestCase::assertEquals比较相等
     * 3.如果$expect和$input都是对象,则用PHPUnit_Framework_TestCase::assertEquals比较相等
     * 3.其他所有情况,均使用PHPUnit_Framework_TestCase::assertSame比较相等
     * 和PHPUnit_Framework_TestCase::assertEquals最大的不同是'abc',true 不再能通过了...
     */
    public static function assertEquals($expected,$actual,$message = '',$delta = 0,
                                        $maxDepth = 10,$canonicalize = FALSE,$ignoreCase = FALSE){
        if ((is_numeric($expected) && is_numeric($actual)) ||
            is_array($expected) && is_array($actual) ||
            is_object($expected) && is_object($actual)){
            parent::assertEquals($expected,$actual,$message,$delta,
                $maxDepth,$canonicalize,$ignoreCase);

            return;
        }
        parent::assertSame($expected,$actual,$message,$delta,$maxDepth,
            $canonicalize,$ignoreCase);

        return;
    }
    public static function assertHtml($string,$msg='')
    {
        static::assertContains('<',$string,$msg);
    }

}